/*
 * FileHandler.java
 *
 * Created on 2 September 2006, 1:38
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package fasea.index.filehandler;

import java.io.File;
import org.apache.lucene.document.Document;

/**
 *
 * @author gvasil
 */
public class LuceneDocumentFactory {

    private boolean STORE_THUMBNAIL;

    public LuceneDocumentFactory(boolean storeThumb) {
        this.STORE_THUMBNAIL = storeThumb;
    }

    /**
     * Analyze the corresponding file and returns a document with the
     * appropriate information filled.
     *
     * @param file the file to be analyzed.
     *
     * @return a document with the appropriate information.
     */
    public Document getDocument(File file) throws FileHandlerException, FileHandlerException {
        FileHandler handler = DocumentType.parse(file).getFileHandler();
        handler.setStoreThumbnail(STORE_THUMBNAIL);
        Document document = handler.getDocument(file);
        return document;
    }
}
